package cn.manyufun.myf.common.Behavior;

import android.content.Context;
import android.graphics.Rect;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.util.AttributeSet;
import android.view.View;

import cn.manyufun.myf.R;

/**
 * @author Kevin Xiao
 * @date Create Date: 2018-02-07
 * @Description
 */


public class FloatLinearLayoutBehavior extends CoordinatorLayout.Behavior {
    private static final boolean AUTO_HIDE_DEFAULT = true;

    private Rect mTmpRect;
    private FloatingActionButton.OnVisibilityChangedListener mInternalAutoHideListener;
    private boolean mAutoHideEnabled;

    public FloatLinearLayoutBehavior() {
        super();
    }

    public FloatLinearLayoutBehavior(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
        return dependency.getId() == R.id.app_bar;
    }

    @Override
    public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {

        child.setY(dependency.getY() + child.getHeight());
        return true;
    }

}